/*
 * Log.c
 *
 *  Created on: Sep 1, 2008
 *      Author: V
 */

#include "../gc6.7/include/gc.h"

#include "Log.h"

#include <assert.h>


pLog gpLog_singleton = NULL;

const char* gLOG_FILENAME = "log.txt";

pLog Log_GetSingleton()
{
	// TODO do Log_GetSingleton
	if (gpLog_singleton == NULL) {
		// create singleton
		gpLog_singleton = GC_malloc(sizeof(Log));
		gpLog_singleton->filename = String_new(gLOG_FILENAME);
		assert(gpLog_singleton->filename != NULL);
		gpLog_singleton->logFile = FileNew(gpLog_singleton->filename,
				String_new("w"));
	}
	return gpLog_singleton;
}

void Log_FunctionEnter(
		pLog log,
		const char* function,
		const char* file,
		int line)
{
	// TODO do Log_FunctionEnter
	pString toAppend = NULL;
	if (toAppend != NULL) {
		File_Append(log->logFile, toAppend);
	}
}

void Log_FunctionExit(pLog log, const char* function, const char* file, int line)
{
	// TODO do Log_FunctionExit
	;
}

void Log_Error(pLog log, const char* description, int errorCode)
{
	// TODO do Log_Error
	;
}

void Log_int(pLog log, const char* name, int value, int line)
{
	// TODO do Log_int
	;
}
